# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: Xu Fasheng <fasheng.xu[AT]gmail.com>

pkgname=deepin-polkit-agent
pkgver=5.4.17
pkgrel=1
pkgdesc='Deepin Polkit Agent'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/dde-polkit-agent"
license=('GPL3')
depends=('deepin-qt5integration' 'deepin-qt-dbus-factory' 'polkit-qt5')
makedepends=('qt5-tools')
groups=('deepin')
source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxdeepin/dde-polkit-agent/archive/$pkgver.tar.gz")
sha512sums=('d63f2f179be8e71dd9998df1f6317674740ead16414be7c520e1d18732647a02f1a7f9c29d76f3ce5846eec359b234419c7a634c4302f67f9e837e2394540f94')

prepare() {
  cd dde-polkit-agent-$pkgver
  # https://github.com/linuxdeepin/developer-center/issues/1721
  sed -i 's/bool is_deepin = true/bool is_deepin = false/' policykitlistener.cpp
  # https://github.com/linuxdeepin/dde-polkit-agent/issues/26
  sed -i '/setCancel/d' policykitlistener.cpp
}

build() {
  cd dde-polkit-agent-$pkgver
  qmake-qt5 PREFIX=/usr
  make
}

package() {
  cd dde-polkit-agent-$pkgver
  make INSTALL_ROOT="$pkgdir" install
}
